﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CSEPT.Tests.SharedLib
{
    [TestClass]
    public class DAL_Test
    {
        [TestMethod]
        public void User()
        {
            DAL dal = new DAL();
            User usr = new User();
            usr.UserName = "TestUser";
            usr.Email = "Email@email.com";
            dal.CreateUser(usr, "1234");
            User CreatedUser = dal.AttemptLogin(usr.UserName, "1234");
            Assert.AreEqual(usr.UserName, CreatedUser.UserName);
            Assert.AreEqual(usr.Email, CreatedUser.Email);
            dal.DeleteUser(CreatedUser);
            try
            {
                dal.GetUser(CreatedUser.ID);
            }
            catch(Exception e)
            {
                Assert.AreEqual(e.Message, "User not found");
            }
        }
    }
}
